#pragma once

#include <gofcl_timer_r.h>

typedef struct {
	u16_s CEN : 1;
	u16_s UPDIS : 1;
	u16_s UPS : 1;
	u16_s SPM : 1;
	u16_s DIR : 1;
	u16_s CAM : 2;
	u16_s ARSE : 1;
	u16_s CKDIV : 2;
	u16_s : 6;
} timer_ctl0_s;

_Static_assert(sizeof(timer_ctl0_s) == 2, "Struct timer_ctl0_s defined error!");

static inline void timer_wreg_ctl0_s(timer_qe timer_q, timer_ctl0_s ctl0) {
	union {
		timer_ctl0_s c;
		u16_s u;
	} cu = {
		.c = ctl0,
	};
	timer_wreg_u16(timer_q, TIMER_CTL0_R, T16B_0_R, cu.u);
}
